<script type="text/javascript">
  $(document).ready(function(){

    // first example
    $("#tree_ul").treeview();
  });

  $(document).on("click", ".closed_dir", function(){
    var parent_html = $(this).parent()
    $.get('<%= url_for(action: :ajax_open_folder) %>', {
      path: $(this).attr("href")
    },
    function(html){
      parent_html.html(html)
    })
    return false
  })

  $(document).on("click", ".open_dir", function(){
    var parent_html = $(this).parent()
    $.get('<%= url_for(action: :ajax_close_folder) %>', {
      path: $(this).attr("href")
    },
    function(html){
      parent_html.html(html)
    })
    return false
  })
</script>

